From 86a387f57165f210f410fddda13fd37ab49c013c Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Tue, 27 Mar 2012 05:11:58 +0200 Subject: [PATCH] stylepropertyimpl: Add color parsing function This is in preparation for removing the specified type and computed type properties from GtkCssStyleProperty, which is in preparation for really using GtkCssValue classes and not GTypes. --- gtk/gtkcssstylepropertyimpl.c | 35 ++++++++++++++++++++++++++++------- 1 file changed, 28 insertions(+), 7 deletions(-) diff --git a/gtk/gtkcssstylepropertyimpl.c b/gtk/gtkcssstylepropertyimpl.c index b78eb24489..7315b9d90e 100644 --- a/gtk/gtkcssstylepropertyimpl.c +++ b/gtk/gtkcssstylepropertyimpl.c @@ -127,6 +127,27 @@ string_append_string (GString *str, /*** IMPLEMENTATIONS ***/ +static GtkCssValue * +color_parse (GtkCssStyleProperty *property, + GtkCssParser *parser, + GFile *base) +{ + GtkSymbolicColor *symbolic; + + if (_gtk_css_parser_try (parser, "currentcolor", TRUE)) + { + symbolic = gtk_symbolic_color_ref (_gtk_symbolic_color_get_current_color ()); + } + else + { + symbolic = _gtk_css_parser_read_symbolic_color (parser); + if (symbolic == NULL) + return NULL; + } + + return _gtk_css_value_new_take_symbolic_color (symbolic); +} + static GtkCssValue * color_compute (GtkCssStyleProperty *property, GtkStyleContext *context, @@ -866,7 +887,7 @@ _gtk_css_style_property_init_properties (void) GDK_TYPE_RGBA, GDK_TYPE_RGBA, GTK_STYLE_PROPERTY_INHERIT, - NULL, + color_parse, NULL, color_compute, NULL, @@ -890,7 +911,7 @@ _gtk_css_style_property_init_properties (void) GDK_TYPE_RGBA, GDK_TYPE_RGBA, 0, - NULL, + color_parse, NULL, color_compute, NULL, @@ -1258,7 +1279,7 @@ _gtk_css_style_property_init_properties (void) GDK_TYPE_RGBA, GDK_TYPE_RGBA, 0, - NULL, + color_parse, NULL, color_compute, NULL, @@ -1270,7 +1291,7 @@ _gtk_css_style_property_init_properties (void) GDK_TYPE_RGBA, GDK_TYPE_RGBA, 0, - NULL, + color_parse, NULL, color_compute, NULL, @@ -1282,7 +1303,7 @@ _gtk_css_style_property_init_properties (void) GDK_TYPE_RGBA, GDK_TYPE_RGBA, 0, - NULL, + color_parse, NULL, color_compute, NULL, @@ -1294,7 +1315,7 @@ _gtk_css_style_property_init_properties (void) GDK_TYPE_RGBA, GDK_TYPE_RGBA, 0, - NULL, + color_parse, NULL, color_compute, NULL, @@ -1306,7 +1327,7 @@ _gtk_css_style_property_init_properties (void) GDK_TYPE_RGBA, GDK_TYPE_RGBA, 0, - NULL, + color_parse, NULL, color_compute, NULL, -- 2.30.2